<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class BaseController extends Controller
{
    protected $user = [];
    protected $limit_arr = [10, 25, 50, 100];

    public function __construct()
    {
        $this->middleware(function ($request, $next) {
            $uid = session()->get('id');
            $account = session()->get('account');
            if (!$uid) return redirect('myadmin/login');
            $this->user['uid'] = $uid;
            $this->user['account'] = $account;
            return $next($request);
        });

        // 分页条数
        view()->composer('Admin/Public/paging_limit', function ($view) {
            $view->with('limit_list', $this->limit_arr);
        });

    }

}